import request from '@/utils/request'

// 管理员购买记录API
export const adminPurchaseApi = {
  // 分页查询购买记录
  getRecordsPage(params) {
    return request({
      url: '/admin/purchase/records/page',
      method: 'get',
      params
    })
  },

  // 获取购买统计信息
  getStatistics() {
    return request({
      url: '/admin/purchase/statistics',
      method: 'get'
    })
  },

  // 获取热门商品排行
  getPopularProducts(params) {
    return request({
      url: '/admin/purchase/popular-products',
      method: 'get',
      params
    })
  },

  // 获取用户购买排行
  getTopBuyers(params) {
    return request({
      url: '/admin/purchase/top-buyers',
      method: 'get',
      params
    })
  },

  // 导出购买记录
  exportRecords(params) {
    return request({
      url: '/admin/purchase/records/export',
      method: 'get',
      params,
      responseType: 'blob'
    })
  },

  // 取消购买记录
  cancelRecord(id) {
    return request({
      url: `/admin/purchase/records/${id}/cancel`,
      method: 'put'
    })
  },

  // 获取购买记录详情
  getRecordDetail(id) {
    return request({
      url: `/admin/purchase/records/${id}`,
      method: 'get'
    })
  }
}

export default adminPurchaseApi 